/*Prepared Using STATA 16: September 16, 2023*/
cap cd ""
use "election_working.dta", clear



/*******************************************************************************************************************************************************************************************************************************/
/*******Table 1: BALANCE*************/

/*Panel A*/
reg age control T1 T2 T3 , nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  replace
reg male control T1 T2 T3 , nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  
reg motorbikes control T1 T2 T3 , nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  
reg polibg control T1 T2 T3 , nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster   
reg polistat control T1 T2 T3 , nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  
reg politicsinterest_rc control T1 T2 T3 , nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  
reg electiondateawareness_rc control T1 T2 T3 , nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  

/*Panel B*/
reg age control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  
reg male control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  
reg motorbikes control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  
reg polibg control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster   
reg polistat control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster   
reg politicsinterest_rc control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  
reg electiondateawareness_rc control T1 T2 T3 if P3=="Yes", nocons
outreg2 using "Tables\Table1_Balance", bdec(3) tdec(3)  ci e(rmse) noaster  excel


/*******************************************************************************************************************************************************************************************************************************/
/*Table 2: Descriptive Statistics of Outcome Variables*/
log using "Tables\Table2_Descriptives.smcl", replace
sum Vote nameNA posNA vote_directly vote_proxy Q11_7 VNALegitimacy_high  VNAConfidence_all VNALegitimacy_all  if treatment_group==0 & Vote<=1
log close
/*******************************************************************************************************************************************************************************************************************************/

/*Figure 6*/
preserve
foreach x in Q11_1 Q11_2 Q11_3 Q11_4 Q11_5 Q11_6 Q11_7 Q11_8 Q11_9 Q11_10 Q11_11 Q11_12 Q11_13 Q11_14 Q11_15 {
    destring `x', replace
	label val `x' YesNo
	replace `x'=`x'*100
}
graph hbar Q11* if treatment_group==0, legend(pos(9) size(medium) label(1 No Reason) label(2 Name topped list) label(3 Relative/friend instructed) label(4 Voting staff instructed) label(5 Personally know candidate) label(6 Personalistic benefits) label(7 Positive change for community) label(8 Represent citizens' interests) label(9 Professional qualifications) label(10 Candidate's gender) label(11 Candidate's age) label(12 Candidate's race) label(13 Candidate's mass organization) label(14 Local knowledge) label(15 Vote for disadvantaged group)) blabel(bar, size(small) position(Inside) format(%3.1f)) ylab(0(2)28, labsize(small)) ytitle("Main reason for vote choice (%)", size(medium) margin(medsmall))
graph save "Figures\Figure6.gph", replace
restore

/*Table 3: OLS Hypothesis 1*/

/*Regression*/
reg Vote T1 T2 T3, cluster(origin) 
outreg2 using "Tables\Table3_OLSVote", bdec(3) tdec(3)   e(rmse) noaster  replace label ctitle(Voted - Unadjusted)
areg Vote T1 T2 T3  i.major_rc , cluster(origin) absorb(strata)
outreg2 using "Tables\Table3_OLSVote", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Voted - Block FE)
reg vote_directly T1 T2 T3  , cluster(origin) 
outreg2 using "Tables\Table3_OLSVote", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Voted Directly - Unadjusted)
areg vote_directly T1 T2 T3  i.major_rc , cluster(origin) absorb(strata)
outreg2 using "Tables\Table3_OLSVote", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Voted Directly - Block FE)
reg vote_proxy T1 T2 T3 , cluster(origin) 
outreg2 using "Tables\Table3_OLSVote", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Voted Proxy - Unadjusted)
areg vote_proxy T1 T2 T3  i.major_rc , cluster(origin) absorb(strata)
outreg2 using "Tables\Table3_OLSVote", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Voted Proxy - Block FE)
reg nameNA T1 T2 T3 , cluster(origin) 
outreg2 using "Tables\Table3_OLSVote", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Candidates - Unadjusted)
areg nameNA T1 T2 T3  i.major_rc , cluster(origin) absorb(strata)
outreg2 using "Tables\Table3_OLSVote", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Candidates - Block FE)
reg posNA T1 T2 T3, cluster(origin)
outreg2 using "Tables\Table3_OLSVote", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Positions - Unadjusted)
areg posNA T1 T2 T3  i.major_rc , cluster(origin) absorb(strata)
outreg2 using "Tables\Table3_OLSVote", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Positions - Unadjusted) excel

/*RI P-Values*/
log using "Tables\Table3_Pvalue.smcl", replace

/*Voted*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): reg Vote T1 T2 T3,cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): reg Vote T1 T2 T3 i.major_rc ,cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): reg Vote T1 T2 T3 i.major_rc ,cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg Vote T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg Vote T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg Vote T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)

/*Voted Directly*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): reg vote_directly T1 T2 T3,cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): reg vote_directly  T1 T2 T3,cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): reg vote_directly  T1 T2 T3,cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_directly  T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_directly  T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_directly  T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)

/*Voted Proxy*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): reg vote_proxy T1 T2 T3,cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): reg vote_proxy T1 T2 T3,cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): reg vote_proxy T1 T2 T3,cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_proxy T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_proxy T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_proxy T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)

/*Name Candidates*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): reg nameNA T1 T2 T3,cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): reg nameNA T1 T2 T3,cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): reg nameNA T1 T2 T3,cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg nameNA T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg nameNA T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg nameNA T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)

/*Name Position*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): reg posNA T1 T2 T3,cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): reg posNA T1 T2 T3,cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): reg posNA T1 T2 T3,cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg posNA T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg posNA T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg posNA T1 T2 T3 i.major_rc ,absorb(strata) cluster(origin)
log close

/*******************************************************************************************************************************************************************************************************************************/
/*Table 4: Voting Subgroup Effects by Youth Union*/
areg Vote T1 T2 T3 i.major_rc if polistat==0, cluster(origin) absorb(strata)
outreg2 using "Tables\Table4_YU", bdec(3) tdec(3)   e(rmse) noaster  replace label ctitle(Voted - Unafilliated)
areg Vote T1 T2 T3  i.major_rc if polistat==1, cluster(origin) absorb(strata)
outreg2 using "Tables\Table4_YU", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Voted - Youth Union)
areg vote_directly T1 T2 T3  i.major_rc if polistat==0, cluster(origin) absorb(strata)
outreg2 using "Tables\Table4_YU", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Voted Directly - Unafilliated)
areg vote_directly T1 T2 T3  i.major_rc if polistat==1, cluster(origin) absorb(strata)
outreg2 using "Tables\Table4_YU", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Voted Directly - Youth Union)
areg vote_proxy T1 T2 T3  i.major_rc if polistat==0, cluster(origin) absorb(strata)
outreg2 using "Tables\Table4_YU", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Voted Proxy - Unafilliated)
areg vote_proxy T1 T2 T3  i.major_rc if polistat==1, cluster(origin) absorb(strata)
outreg2 using "Tables\Table4_YU", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Voted Proxy - Youth Union)
areg nameNA T1 T2 T3  i.major_rc if polistat==0, cluster(origin) absorb(strata)
outreg2 using "Tables\Table4_YU", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Name Candidate - Unafilliated)
areg nameNA T1 T2 T3  i.major_rc if polistat==1, cluster(origin) absorb(strata)
outreg2 using "Tables\Table4_YU", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Name Candidate - Youth Union)
areg posNA T1 T2 T3  i.major_rc if polistat==0, cluster(origin) absorb(strata)
outreg2 using "Tables\Table4_YU", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Name Position - Unafilliated)
areg posNA T1 T2 T3  i.major_rc if polistat==1, cluster(origin) absorb(strata)
outreg2 using "Tables\Table4_YU", bdec(3) tdec(3)   e(rmse) noaster label ctitle(Name Candidate - Youth Union) excel

/*RI P-Values*/
log using "Tables\Table4_Pvalue.smcl", replace

/*Voted*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg Vote T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg Vote T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg Vote T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg Vote T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg Vote T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg Vote T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)

/*Voted Directly*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_directly T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_directly  T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_directly  T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_directly  T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_directly  T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_directly  T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)

/*Voted Proxy*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_proxy T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_proxy T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_proxy T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_proxy T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_proxy T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg vote_proxy T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)

/*Name Candidates*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg nameNA T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg nameNA T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg nameNA T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg nameNA T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg nameNA T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg nameNA T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)

/*Name Position*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg posNA T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg posNA T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg posNA T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg posNA T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg posNA T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg posNA T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
log close
/*******************************************************************************************************************************************************************************************************************************/

/*Table 5: Hypothesis 2*/

/*Reason for Voting*/
reg Q11_7 T1 T2 T3, robust
outreg2 using "Tables\Table5_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster  replace label ctitle(Change - Unadjusted)
areg Q11_7 T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
outreg2 using "Tables\Table5_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster  label ctitle(Change - Block FE)

/*Full Legitimacy*/
reg VNALegitimacy_all T1 T2 T3, robust
outreg2 using "Tables\Table5_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster  label ctitle(Legitimacy - Unadjusted)
areg VNALegitimacy_all T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
outreg2 using "Tables\Table5_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster  label ctitle(Legitimacy - Block FE)

/*Dichotomous Legitimacy*/
reg VNALegitimacy_high T1 T2 T3, robust
outreg2 using "Tables\Table5_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster  label ctitle(Legitimacy_Dummy - Unadjusted)
areg VNALegitimacy_high T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
outreg2 using "Tables\Table5_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster  label ctitle(Legitimacy_Dummy - Block FE)

*Confidence in VNA to represent self/community interest
reg VNAConfidence_all T1 T2 T3, robust
outreg2 using "Tables\Table5_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster  label ctitle(Confidence - Unadjusted)
areg VNAConfidence_all T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
outreg2 using "Tables\Table5_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster  label ctitle(Confidence - Block FE) excel



/*RI P-Values*/
log using "Tables\Table5_Pvalue.smcl", replace

/*Reason for Voting*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): reg Q11_7 T1 T2 T3 
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): reg Q11_7 T1 T2 T3 
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): reg Q11_7 T1 T2 T3  
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg Q11_7 T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg Q11_7 T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg Q11_7 T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)

/*Full Legitimacy*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): reg VNALegitimacy_all T1 T2 T3 
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): reg VNALegitimacy_all T1 T2 T3 
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): reg VNALegitimacy_all T1 T2 T3 
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_all T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_all T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_all T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)

/*Dichotomous Legitimacy*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): reg VNALegitimacy_high T1 T2 T3 
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): reg VNALegitimacy_high T1 T2 T3 
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): reg VNALegitimacy_high T1 T2 T3 
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_high T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_high T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_high T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)

*Confidence in VNA to represent self/community interest
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): reg VNAConfidence_all T1 T2 T3 
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): reg VNAConfidence_all T1 T2 T3 
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): reg VNAConfidence_all T1 T2 T3 
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg VNAConfidence_all T1 T2 T3 i.major_rc,absorb(strata) cluster(origin) 
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg VNAConfidence_all T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg VNAConfidence_all T1 T2 T3 i.major_rc,absorb(strata) cluster(origin)
log close

/*******************************************************************************************************************************************************************************************************************************/

/*Table 6: Hypothesis 2 by Youth Union*/

*Reason for Voting
reg  Q11_7 T1 T2 T3 i.strata i.major_rc if polistat==0, cluster(origin)
outreg2 using "Tables\Table6_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster  replace label ctitle(Change - Unafilliated)
reg  Q11_7 T1 T2 T3 i.strata i.major_rc if polistat==1, cluster(origin)
outreg2 using "Tables\Table6_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster  label ctitle(Change - Youth Union)

*VNA Legitimacy
reg  VNALegitimacy_all T1 T2 T3 i.strata i.major_rc if polistat==0, cluster(origin)
outreg2 using "Tables\Table6_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster   label ctitle(Legitimacy - Unafilliated)
reg  VNALegitimacy_all  T1 T2 T3 i.strata i.major_rc if polistat==1, cluster(origin)
outreg2 using "Tables\Table6_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster   label ctitle(Legitimacy - Youth Union)

*VNA Legitimacy High
reg  VNALegitimacy_high T1 T2 T3 i.strata i.major_rc if polistat==0, cluster(origin)
outreg2 using "Tables\Table6_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster   label ctitle(Legitimacy_Dummy - Unafilliated)
reg  VNALegitimacy_high  T1 T2 T3 i.strata i.major_rc if polistat==1, cluster(origin)
outreg2 using "Tables\Table6_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster   label ctitle(Legitimacy_Dummy - Youth Union)

*VNA Legitimacy High
reg  VNAConfidence_all T1 T2 T3 i.strata i.major_rc if polistat==0, cluster(origin)
outreg2 using "Tables\Table6_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster   label ctitle(Confidence - Unafilliated)
reg  VNAConfidence_all  T1 T2 T3 i.strata i.major_rc if polistat==1, cluster(origin)
outreg2 using "Tables\Table6_OLSLegitimacy", bdec(3) tdec(3)   e(rmse) noaster   label ctitle(Confidence - Youth Union) excel


/*RI P-Values*/
log using "Tables\Table6_Pvalue.smcl", replace

/*Reason for Voting*/
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg Q11_7 T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg Q11_7 T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg Q11_7 T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg Q11_7 T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg Q11_7 T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg Q11_7 T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)

*VNA Legitimacy
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_all T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_all T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_all T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_all T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_all T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_all T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)



*VNA Legitimacy High
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_high T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_high T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_high T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_high T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_high T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg VNALegitimacy_high T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)

*Confidence
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg VNAConfidence_all T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg VNAConfidence_all T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg VNAConfidence_all T1 T2 T3 i.major_rc if polistat==0,absorb(strata) cluster(origin)
ritest T1 _b[T1],  kdensityplot reps(1000) seed(125) strata(strata): areg VNAConfidence_all T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T2 _b[T2],  kdensityplot reps(1000) seed(125) strata(strata): areg VNAConfidence_all T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
ritest T3 _b[T3],  kdensityplot reps(1000) seed(125) strata(strata): areg VNAConfidence_all T1 T2 T3 i.major_rc if polistat==1,absorb(strata) cluster(origin)
log close



